package com.yun.routing.topic;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.yun.utils.ConnectionUtil;
import org.junit.Test;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class Provider {

    private static final String EXCHANGE_NAME = "topic_logs";
    @Test
    public void provider() throws IOException {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare(EXCHANGE_NAME,"topic");

        channel.basicPublish(EXCHANGE_NAME,"topic.info",null,"topic-info 发送信息".getBytes(StandardCharsets.UTF_8));
        channel.basicPublish(EXCHANGE_NAME,"topic.error",null,"topic-error 发送信息".getBytes(StandardCharsets.UTF_8));
        channel.basicPublish(EXCHANGE_NAME,"topic.error.test",null,"topic-error-test 发送信息".getBytes(StandardCharsets.UTF_8));
        channel.basicPublish(EXCHANGE_NAME,"logs.topic.debug",null,"topic-error-test 发送信息".getBytes(StandardCharsets.UTF_8));

    }

}
